#!/bin/bash
set -x
Server_IP=127.0.0.1
NODE_ID=0
./tc &

while [ ${NODE_ID} -lt 16 ]
do

  # 清理进程
  killall iperf3
  sleep 3
  # 启动server
  index=0
  while [ ${index} -lt 8 ]
  do
          numactl -N ${NODE_ID} -m ${NODE_ID} iperf3 -s -B ${Server_IP} -p 100${index} > /dev/null 2>&1 &
          let index=${index}+1
  done
  # 等待server启动
  sleep 3
  counter=0
  while [ ${counter} -lt 30 ]
  do
          echo "fio $(date) counter=${counter}"
          let index=0
          while [ ${index} -lt 7 ]
          do
                  numactl -N ${NODE_ID} -m ${NODE_ID} iperf3 -c ${Server_IP} -p 100${index} > /dev/null 2>&1 &
                  let index=${index}+1
          done
          numactl -N ${NODE_ID} -m ${NODE_ID} iperf3 -c ${Server_IP} -p 100${index} > /dev/null 2>&1
          let counter=${counter}+1
  done
  let NODE_ID=${NODE_ID}+1
done

